local beBufff = CreateFrame("Frame", nil, UIParent)
local playerName = UnitName("player")
beBufff:RegisterEvent"COMBAT_LOG_EVENT_UNFILTERED"

-- config
    -- weapon buffs fades
        local beBufffTrackWeaponBuffFadesSoundActive = true
        local beBufffTrackWeaponBuffFadesSound = "Sound\\Event Sounds\\Event_wardrum_ogre.wav"
        local beBufffTrackWeaponBuffFadesTextActive = true

    -- buff gains
        local beBufffTrackedBuffsGain = {
        	[37723] = "Sound\\Event Sounds\\Event_wardrum_ogre.wav", -- healing trance
        	--[16237] = "Sound\\Event Sounds\\Event_wardrum_ogre.wav" -- ancestral fortitude
        }
        local beBufffTrackedBuffsGainText = {
            [37723] = "Healing Trance" -- healing trance
        }

    -- buff fades
        local beBufffTrackedBuffsFade = {
            [28519] = "Sound\\Event Sounds\\Event_wardrum_ogre.wav", -- flask of mighty restoration
        }
        local beBufffTrackedBuffsFadeText = {
            [28519] = "Flask of Mighty Restoration fades!" -- flask of mighty restoration
        }

-- chat write
    function beBufff:ChatMessage(message)
        ChatFrame1:AddMessage("|cff0033CCbe|r|cff888888Bufff|r: " .. message); 
    end

-- cl event
    beBufff:SetScript("OnEvent", function(self, event, timeStamp, eventType, sourceGUID, sourceName, sourceFlags, destGUID, destName, destFlags) 
        if event == "COMBAT_LOG_EVENT_UNFILTERED" then       
            if eventType =="SPELL_AURA_REMOVED" then 
                local spellId = arg9
                if destName == playerName then
                    if beBufffTrackedBuffsFade[spellId] then
                        PlaySoundFile(beBufffTrackedBuffsFade[spellId])
                    end
                    if beBufffTrackedBuffsFadeText[spellId] then
                        beBufff:ChatMessage(beBufffTrackedBuffsFadeText[spellId])
                    end
                end
            elseif eventType =="SPELL_AURA_APPLIED" then 
                local spellId = arg9
                if destName == playerName then
                    if beBufffTrackedBuffsGain[spellId] then
                        PlaySoundFile(beBufffTrackedBuffsGain[spellId])
                    end
                    if beBufffTrackedBuffsGainText[spellId] then
                        beBufff:ChatMessage(beBufffTrackedBuffsGainText[spellId])
                    end
                end
            elseif eventType =="ENCHANT_REMOVED" then 
                if destName == playerName then
                    if beBufffTrackWeaponBuffFadesSoundActive then
                        PlaySoundFile(beBufffTrackWeaponBuffFadesSound)
                    end
                    if beBufffTrackWeaponBuffFadesTextActive then
                        local buff, itemName = arg9, arg11
                        beBufff:ChatMessage(buff .. " |cffff0000" .. itemName .. "|r")
                    end
                end
            end
         end 
    end) 